package com.tsmti.lab.controller.basedata;

import com.tsmti.basicdata.entity.DeptInfomation;
import com.tsmti.core.common.constant.RedisConstants;
import com.tsmti.core.common.controller.BaseCrudController;
import com.tsmti.core.util.RedisUtils;
import com.tsmti.shiro.annotation.RequiresPathPermission;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by  on 2018/11/14.
 * @author cyy
 */
@RequiresPathPermission("baseData:dept")
@RequestMapping("/baseData/dept")
@Controller
public class DeptController extends BaseCrudController<DeptInfomation, Long> {
    @Override
    public void afterSave(DeptInfomation entity, HttpServletRequest request, HttpServletResponse response) {
        try {
            RedisUtils.setObject(RedisConstants.DEPT_CACHE, entity.getCode(), entity);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
